package cn.com.ustudy.course.core.model.entity;

import cn.melonlib.cores.commons.model.entity.TenantRecordEntity;
import cn.melonlib.cores.model.anno.ModelComment;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;

import javax.persistence.*;

@Data
@EqualsAndHashCode(callSuper = true)
@Entity(name = "CourseCatalog")
@Table(name = "crs_catalog")
@ModelComment("课程分类")
public class CourseCatalog extends TenantRecordEntity {

    @ModelComment(value = "分类编号",required = true)
    private String code;

    @ModelComment(value = "分类名称",required = true)
    private String name;

    @ModelComment("备注")
    @Column@Lob@Basic(fetch = FetchType.LAZY)@Type(type = "org.hibernate.type.TextType")
    private String memo;

    @ManyToOne(cascade = {CascadeType.REFRESH},fetch = FetchType.LAZY)
    @JoinColumn(name = "parent_id")
    private CourseCatalog parent;
}
